package structure.flyweight;

/**
 * @author lzp
 * @Date:2023/2/27
 * @description: 享元模式测试类, 总是使用工厂方法而不是new操作符创建实例，可获得享元模式的好处
 */
public class FlyWeight {

	public static void main(String[] args) {
		System.out.println("================ 带缓存的方式创建用户 ===============");
		System.out.println(Student.crete("lzp", 1) == Student.crete("lzp", 1));
		System.out.println("================ 通过构造方法创建用户 ===============");
		System.out.println(new Student("lzp", 1) == new Student("lzp", 1));
	}

}
